In a data processor that performs arithmetic operations, typically a single chip floating point coprocessor or a floating point processor integrated on-chip, numbers are expressed in a floating-point format as a mantissa and an exponent. When two numbers expressed in the floating point format are to be added or subtracted, the exponents of the two numbers must first be made equal. The exponents of the two numbers are made equal by shifting one of the numbers by an amount equal to a difference between the two exponents, a process called denormalization shift. When the exponents of the numbers are made equal by the denormalization shift, the numbers can then be added or substracted by hardware circuitry.
To accomplish the denormalization shift, the exponents are first subtracted. The difference in the exponents may be negative or positive, however, since it is not known before the subtraction which of the two numbers is larger. To calculate the denormalization shift amount from the exponents of the two numbers, it is necessary to determine an absolute value of a difference of the two exponents. The absolute value operation can be performed as follows. If the difference in the exponents is a positive number, then the absolute value of the difference is simply equal to the difference. If the difference is a negative number, however, the difference must be converted to a positive number. Converting a negative number to a positive number is more complicated if the difference is in two's complement format than in another format like one's complement. The absolute value of a negative number in two's complement format can be determined by complementing the negative number, and then adding one to the result. Converting a negative number to a positive number in this manner is time consuming because a complemented negative number must be moved into an adder, and added to one. A resulting carry operation can consume several clock cycles in a worst case scenario. Subsequently, the absolute value thus obtained must be decoded to provide a unique signal for each absolute value. Since performing such a function is frequently necessary in an arithmetic data processor, overall performance is greatly limited by the speed of performing this function.